package com.cx.mall.goods.controller;

import com.cx.mall.common.utils.ResponseVO;
import com.cx.mall.common.model.goods.Brand;
import com.cx.mall.goods.service.IBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 品牌表 前端控制器
 * </p>
 *
 * @author lyt
 * @since 2025-07-10
 */
@RestController
@RequestMapping("goods/brand")
public class BrandController {
    @Autowired
    private IBrandService brandService;

    @GetMapping("/category/1/{id}")
    public ResponseVO<List<Brand>> OneCategoryId(@PathVariable("id") Integer id){
        return ResponseVO.success(brandService.listByOneCategoryId(id));
    }

    @GetMapping("/category/2/{id}")
    public ResponseVO<List<Brand>> TwoCategoryId(@PathVariable("id") Integer id){
        return ResponseVO.success(brandService.listByTwoCategoryId(id));
    }

    @GetMapping("/category/3/{id}")
    public ResponseVO<List<Brand>> ThreeCategoryId(@PathVariable("id") Integer id){
        return ResponseVO.success(brandService.listByThreeCategoryId(id));
    }


    @GetMapping("list")
    public ResponseVO<List<Brand>> list(){
        return ResponseVO.success(brandService.list());
    }

}
